package com.bclz.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

@Configuration
public class JacksonConfig {
	
	
	  @Bean
	  public ObjectMapper JsonObjectMapper(){
	   ObjectMapper objectMapper=new ObjectMapper();
	   // 忽略json字符串中不识别的属性
	   objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	   // 忽略无法转换的对象 “No serializer found for class com.xxx.xxx”
	   objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);
	   return objectMapper;
	  }
	
}
